<?php 
if(!defined('ADMIN')){
	exit('Access Denied');
}
//pp($orderinfo);

?>
<div class="pageHeader">
	<p><b>订单管理 > 查看订单详情</b></p>
</div>
<div class="pageContent" >
<form method="post" action="index.php?mod=order&act=viewdone" class="pageForm required-validate form" onsubmit="return validateCallback(this,navTabAjaxDone)">
<input type="hidden" name="sub" value="save" />
<input type="hidden" name="id" value="<?=$id?>" />
<input type="hidden" name="goodssn" value="<?=$orderinfo["ordersn"]?>" />
<input type="hidden" name="start_time" value="<?=$orderinfo["servicebetime"]?>" />
<input type="hidden" name="stop_time" value="<?=$orderinfo["serviceendtime"]?>" />
<input type="hidden" name="is_given" value="<?=$orderinfo["is_given"]?>" />
<div class="pageFormContent nowrap" layoutH="80" style="overFlow-x: hidden;">
<h4>订单信息</h4>
<table class="tb">
    <? if($orderinfo["status"] == 1&&$orderinfo['is_given']==1){ ?>
    <tr>
				<th><label for="">选择厨师</label></th>
				<td><?=select($result_list,$s,'fansid')?></td>
			</tr>
                        <?}?>
			<tr>
				<th><label for="">订单号</label></th>
				<td><?=$orderinfo["ordersn"]?></td>
			</tr>
			<tr>
				<th><label for="">总金额</label></th>
				<td>￥<?=number_format($orderinfo["totalprice"],2)?>元
				</td>
			</tr>

			<tr>
				<th><label for="">付款方式</label></th>
				<td>
                <?
                 if($orderinfo['paytype']==1){
                    echo "微信支付";
                 }elseif($orderinfo['paytype']==2){
                    echo "支付宝支付";
                 }elseif($orderinfo['paytype']==3){
                    echo "快钱支付";
                 }elseif($orderinfo['paytype']==4){
                    echo "汇付天下";
                 }
                 else{
                     echo "其他方式";//5
                 }

                 if($orderinfo['ispay']==1){
                    echo '<span class="label label-success">已预付</span>';
                 }elseif($orderinfo['ispay']==2){
                    echo '<span class="label label-success">已付款</span>';
                 }
                 else{
                    echo '<span class="label label-error">未支付</span>';
                 }
                ?>					
				</td>
			</tr>
			<tr>
				<th><label for="">订单状态</label></th>
				<td>
                    <? if($orderinfo['status'] == -1){ echo '<span class="label label-info">已废弃</span>';} ?>
                    <? if($orderinfo['status'] == 0){ echo '<span class="label label-info">未预付</span>';} ?>
					<? if($orderinfo['status'] == 1){ echo '<span class="label label-info">已预付</span>';} ?>
					<? if($orderinfo['status'] == 2){ echo '<span class="label label-info">可接单</span>';} ?>
                    <? if($orderinfo['status'] == 3){ echo '<span class="label label-success">已付款</span>';} ?>
                    <? if($orderinfo['status'] == 4){ echo '<span class="label label-info">已完成</span>';} ?>
                    <? if($orderinfo['status'] == 5){ echo '<span class="label label-info">已评价</span>';} ?>
                                    
			</td>
			</tr>
			<tr>
				<th><label for="">下单日期</label></th>
				<td><?=date("Y-m-d H:i:s",$orderinfo["createtime"])?></td>
			</tr>
            <tr>
                <th><label for="">服务名厨</label></th>
                <td><?=$chefname?></td>
            </tr>
			<tr>
				<th><label for="">服务时间</label></th>
				<td><?=$orderinfo['time_day']?></td>
			</tr>			
			<tr>
				<th>备注</th>
				<td>
					<textarea style="height:50px;" class="span7" name="remark" cols="70"><?=$orderinfo["remark"]?></textarea>
				</td>
			</tr>
		</table>
		<h4>用户信息</h4>
		<table class="tb">
			<tr>
				<th><label for="">姓名</label></th>
				<td><?=$orderinfo["guest_name"]?>
				</td>
			</tr>
			<tr>
				<th><label for="">手机</label></th>
				<td><?=$orderinfo["tel"]?></td>
			</tr>
			<tr>
				<th><label for="">地址</label></th>
				<td><?=$orderinfo["guest_address"]?></td>
			</tr>
		</table>
                
		<h4>商品信息</h4>
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:30px;">序号</th>
                    <th style="width:100px;">菜品货号</th>
					<th >商品标题</th>
 					<th style="width:100px;">销售价</th>
					
					<th style="width:100px;">数量</th>
                    
                    <th style="width:100px;">小计</th>
				</tr>
			</thead>
			<?
            $i=1;
            while(list($k,$v)=each($goodsinfo)){
            ?>    
            <tr>
			<td class="center"><?=$i?></td>
            <td  class="center"><?=$v["goodssn"]?></td>
			<td>
            <?
            if(!empty($catlisttemp[$v['pcate']])){
            ?>
            <span class="text-error">[<?=$catlisttemp[$v['pcate']]['name']?>] </span>
            <?
             }
            ?>
            <?=$v["title"]?></td>
				<td >￥<?=number_format($v["price"],2)?>元</td>
				<td><?=$v["total"]?></td>
				<td style="background:#f2dede;">￥<?=number_format($v["total"]*$v["price"],2)?>元</td>
                
			</tr>            
            
            <?
            $i++;
            }
            ?>
		</table>
                
		
<input type="hidden" name="token" value="<?=$token?>" />
<input type="hidden" name="opid" id="opid" value="" />

</div>
<div class="formBar">
<ul style="float:left;">
<?
if($orderinfo["status"]==0){
?>
<li><div class="buttonActive"><div class="buttonContent"><button type="submit" class="btn btn-primary span2" onclick="$('#opid').val('1');return confirm('确认预付此订单吗？'); return false;" name="confrim" >确认预付</button></div></div></li>
<?
}elseif($orderinfo['status'] == 1){
?>
    <? if($orderinfo['is_given']==0){ ?>
        <li><div class="buttonActive"><div class="buttonContent"><button type="submit" class="btn span2 btn-primary" onclick="$('#opid').val('2');return confirm('确认下发此订单吗？'); return false;"  value="关闭">下发订单</button></div></div></li>
    <? } ?>
    <? if($orderinfo['is_given']==1){ ?>
        <li><div class="buttonActive"><div class="buttonContent"><button type="submit" class="btn span2 btn-primary" onclick="$('#opid').val('3');return confirm('确认接此订单吗？'); return false;"  value="关闭">确认接单</button></div></div></li>
    <? } ?>
<?
}elseif($orderinfo['status'] == 2){
?>
<li><div class="buttonActive"><div class="buttonContent"><button type="submit" class="btn btn-primary span2" name="cancel" value="正常" onclick="$('#opid').val('4');return confirm('确认完成付款此订单吗？'); return false;">确认付款</button></div></div></li>
<?}elseif($orderinfo['status'] == 3){?>
<li><div class="buttonActive"><div class="buttonContent"><button type="submit" class="btn btn-primary span2" name="cancel" value="正常" onclick="$('#opid').val('5');return confirm('确认完成此订单吗？'); return false;">完成订单</button></div></div></li>
<?}//还剩评价todo?>


<?
if($orderinfo["status"]<>-1){
?>
<li><div class="buttonDisabled"><div class="buttonContent"><button type="submit" class="btn span2" name="close" onclick="$('#opid').val('20');return confirm('确认废弃此订单吗？'); return false;" value="关闭">废弃订单</button></div></div></li>
<?
}
?>

<li><div class="buttonActive"><div class="buttonContent"><button type="button" class="btn btn-primary span2" name="confrimprint" value="正常">打印订单</button></div></div></li>


</ul>
</div>
</form>